package cn.ruituo.service;

import cn.ruituo.dao.GradeDao;
import cn.ruituo.entity.Grade2;
import cn.ruituo.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class GradeService {
    public final static GradeService service=new GradeService();
    public List<Grade2> findALL(){
        SqlSession s= MyBatisUtil.get();
        try {
            GradeDao dao = s.getMapper(GradeDao.class);
            List<Grade2> all = dao.findALL();
            System.out.println("connection:"+s.getConnection().hashCode());
            return all;
        }finally {
            MyBatisUtil.close(s);
        }
    }
}
